/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author selam
 */
@Entity
@Table(name = "productcontainment")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Productcontainment.findAll", query = "SELECT p FROM Productcontainment p"),
    @NamedQuery(name = "Productcontainment.findByPCId", query = "SELECT p FROM Productcontainment p WHERE p.pCId = :pCId")})
public class Productcontainment implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "PCId")
    private Integer pCId;
    @JoinColumn(name = "ProductId", referencedColumnName = "ProductId")
    @ManyToOne(optional = false)
    private Product productId;
    @JoinColumn(name = "GPackageId", referencedColumnName = "GPackageId")
    @ManyToOne(optional = false)
    private Generalpackage gPackageId;

    public Productcontainment() {
    }

    public Productcontainment(Integer pCId) {
        this.pCId = pCId;
    }

    public Integer getPCId() {
        return pCId;
    }

    public void setPCId(Integer pCId) {
        this.pCId = pCId;
    }

    public Product getProductId() {
        return productId;
    }

    public void setProductId(Product productId) {
        this.productId = productId;
    }

    public Generalpackage getGPackageId() {
        return gPackageId;
    }

    public void setGPackageId(Generalpackage gPackageId) {
        this.gPackageId = gPackageId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pCId != null ? pCId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Productcontainment)) {
            return false;
        }
        Productcontainment other = (Productcontainment) object;
        if ((this.pCId == null && other.pCId != null) || (this.pCId != null && !this.pCId.equals(other.pCId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Productcontainment[ pCId=" + pCId + " ]";
    }
    
}
